#include <vector>
using namespace std;


// version 1
class Solution {
public:
    int maxArea(vector<int>& height) {
        int max_volumn = 0;
        int left = 0, right = height.size() - 1;
        while(left < right){
            int volumn = (right - left) * std::min(height[left], height[right]);
            if(volumn > max_volumn) max_volumn = volumn;
            (height[left] <= height[right]) ? ++left : --right;
        }
        return max_volumn;
    }
};